package zl.tests;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;

/**
 * @author  SuperZL 
 * @version 2012-9-3 上午8:33:08
 */
public class ClipboardTest {
	
	public static void main(String[] args) throws UnsupportedFlavorException, IOException{
		Clipboard clipboard = new Clipboard("test");
		clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
		clipboard.setContents(new StringSelection("这是我通过编程放入剪切板的内容。屌吧！"),null);
		if(clipboard.isDataFlavorAvailable(DataFlavor.stringFlavor))
			System.out.println("当前系统剪切板内容："+(String)clipboard.getData(DataFlavor.stringFlavor));
	}
}
